package camel.server.session;

import java.io.Serializable;

/**
 *
 * @author mac
 */
public class ParticipantCursorKey implements Serializable {
    private static final long serialVersionUID = 1L;
    
    private Long id;
    private String userId;

    @Override
    public int hashCode() {
        return (((this.getId() == null) ? 0
                                                : this.getId()
                                                      .hashCode())
        ^ ((this.getUserId() == null) ? 0
                                                : this.getUserId()
                                                      .hashCode()));
    }

    @Override
    public boolean equals(Object otherOb) {
        if (this == otherOb) {
            return true;
        }

        if (!(otherOb instanceof SessionCommandKey)) {
            return false;
        }

        ParticipantCursorKey other = (ParticipantCursorKey) otherOb;

        return (((this.getId() == null) ? (other.getId() == null)
                                                : this.getId()
                                                      .equals(
                other.getId())))
        && (((this.getUserId() == null) ? (other.getUserId() == null)
                                                : this.getUserId()
                                                      .equals(
                other.getUserId())));
    }

    @Override
    public String toString() {
        return getUserId() + " #" + this.getId();
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

}
